Skip to content

Improve blob docs - #399

Open
rwb27 wants to merge 2 commits into
mainfrom
improve-blob-docs
Open

rwb27 wants to merge 2 commits into
mainfrom
improve-blob-docs

Conversation

@rwb27

@rwb27 rwb27 commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator

This tidies up the explanation of how blobs are structured and managed.

I experimented with sphinxcontrib-mermaid for diagrams, and have added one to the section that @julianstirling found confusing. I'm very open to improvements, but I think it's already quite helpful.

Closes #308

@barecheck

barecheck Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Barecheck - Code coverage report

Total: 97.46%

Your code coverage diff: 0.03% ▴

✅ All code changes are covered

Comment thread docs/source/blobs.rst
-------------------------------

Management of `.Blob` objects is currently very basic: when a `.Blob` object is returned in the output of an Action that has been called via the HTTP interface, it will be retained as long as the action's output. This may be set on each action, and defaults to 5 minutes. This should be improved in the future to avoid memory management issues.
A `.Blob` instance holds a strong reference to exactly one `.BlobData` object, which refers to data on memory, on disk, or at a remote network location. Using class methods, it's possible to retrieve a `.BlobData` object using a unique ID. This is used internally by LabThings to allow the data to be downloaded, and to allow Blobs to be passed as input to actions. Only a weak reference is retained by the class, so this mechanism does not prevent the data from being finalised: a strong reference to the `.Blob` object must exist somewhere, or the data will be discarded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BlobData object is not included in the mermaid diagram.
It might be useful to either:

  1. Extend the original diagram to include BlobData (but that might make the diagram messy, and its quite easy to read at present)
  2. Make a new mermaid diagram with an explanation about BlobData usage, and include it here. This could be a sequence diagram (like the existing mermaid diagram) or a class diagram.

Comment thread docs/source/blobs.rst
Management of `.Blob` objects is currently very basic: when a `.Blob` object is returned in the output of an Action that has been called via the HTTP interface, it will be retained as long as the action's output. This may be set on each action, and defaults to 5 minutes. This should be improved in the future to avoid memory management issues.
A `.Blob` instance holds a strong reference to exactly one `.BlobData` object, which refers to data on memory, on disk, or at a remote network location. Using class methods, it's possible to retrieve a `.BlobData` object using a unique ID. This is used internally by LabThings to allow the data to be downloaded, and to allow Blobs to be passed as input to actions. Only a weak reference is retained by the class, so this mechanism does not prevent the data from being finalised: a strong reference to the `.Blob` object must exist somewhere, or the data will be discarded.

When a `.Blob` object is returned in the output of an Action that has been called via the HTTP interface, it will be retained as long as the action's output by the `.ActionManager`. The retention period may be set on each action, and defaults to 5 minutes. This should be improved in the future to avoid memory management issues.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue for this last point?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explain how Blob data is managed beter

2 participants